<!--
 * @Author: Aaron
 * @Date: 2022-02-18 10:02:44
 * @LastEditors: Aaron
 * @LastEditTime: 2022-06-02 13:51:41
 * @Description: file content
 * @FilePath: \ias_ui\src\views\coi\spuChannelInventory\index\serialInventory.vue
 * @Company: 沃尔玛
-->
<template>
  <div v-loading="loading">
    <search-head
      :search-list="searchList"
      :search-data="searchData"
      @handleSearch="handleSearch"
      @handleReset="handleReset"
      @handleDownload="handleDownload('SPU商品库')"
    />
    <ess-table
      ref="table"
      :thead-list="serialInventory"
      :other-container-box="otherContainerBox"
      :resize-observer-ele="resizeObserverEle"
      :total="total"
      :data-list="dataList"
      :page-params="pageParams"
      row-key="spuCode"
      @handlePageChange="requestData"
      @operationLog="operationLog"
      @handleEdit="handleEdit"
    >
      <template v-slot:productName="{ scope }">
        <span class="el-button--text el-button--mini" @click="goSpuDetails(scope)">{{ scope.row.spuName }}</span>
      </template>

    </ess-table>
    <purchaseLog v-model="logVisible" width="900px" :title="title" :thead-list="operationLogTableHeader" :data-list="operationLogTableList" />
  </div>
</template>

<script>
import searchHead from '@/components/searchHead/searchHead.vue'
import essTable from '@/components/eTable/eTable.vue'
import { serialInventory } from '../../commonJs/spuWarehouseTableHead'
import { tableParams, searchHeaderEvent } from '@/components/eTable/js/mixins.js'
import { serialInventoryTableFun, getLogs, handleEditMinxin, spuDetail } from '../js/requestMixins'
import purchaseLog from '@/components/dialogTableInfo/dialogTableInfo.vue'
import bus from '@/utils/eventBus.js'

export default {
  name: 'SerialInventory',
  components: {
    searchHead,
    essTable,
    purchaseLog
  },
  mixins: [tableParams, serialInventoryTableFun, searchHeaderEvent, getLogs, handleEditMinxin, spuDetail],
  data() {
    return {
      loading: false,
      searchData: {},
      otherContainerBox: ['.app-container', '.checkComponent'],
      resizeObserverEle: ['.app-main', '.app-container'],
      searchList: [
        { label: 'UPC(不含检验码)', type: 'textarea', value: 'skuCodeList' },
        { label: 'SPU名称', type: 'input', value: 'spuName' },
        { label: '部门', type: 'input', value: 'deptNbr' }
      ],
      serialInventory
    }
  },
  methods: {
    goDetails({ row }) {
      console.log(row)
      bus.$emit('setTagName', row.spuName)
      const id = row.spuCode
      this.$router.push({
        path: `/spuSeries/${id}/details/${this.$route.name}`
      })
    }
  }
}
</script>

<style lang="scss" scoped>
/deep/ .table-header {
  padding-bottom: 10px;
}
</style>
